﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomerPopup.aspx.cs" Inherits="Admin_Components_MasterData_CustomerPopup" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Thông tin khách hàng</title>
    <link href="../../../Template/Css/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
    <link href="../../../Template/Css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../../../Template/Css/bootstrap.custom.css" rel="stylesheet" type="text/css" />
    <!--  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>-->
    <script src="../../../Template/Javascript/jquery.min.js" type="text/javascript"></script>
    <script src="../../../Template/Javascript/bootstrap.min.js" type="text/javascript"></script>
    <script src="../../../Template/Javascript/jquery.validate.js" type="text/javascript"></script>
    <script src="../../../Template/Javascript/control.js" type="text/javascript"></script>
    <script src="../../../Template/Javascript/validation.js" type="text/javascript"></script>
    <script src="../../../Template/Javascript/confirmBox.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:radscriptmanager id="RadScriptManager" runat="server"></telerik:radscriptmanager>
        <telerik:RadFormDecorator ID="RadFormDecorator" DecoratedControls="All" runat="server" />
        
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <br /><br />
            <div class="form-horizontal wrapper-center clearfix">
                <div class="row col-md-12">
                 <!--Block bên trái -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Mã khách hàng</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtCustomerCode" CssClass="col-imp-6 required"  runat="server"   />
                        </div>
                    </div>
                  <!--End Dòng -->
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                          Số điện thoại</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtPhoneNumber" CssClass="col-imp-6 required"  runat="server"   />
                            <asp:RequiredFieldValidator  ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtPhoneNumber" ValidationGroup="g1"
                           ErrorMessage="Required." >Required</asp:RequiredFieldValidator>
                        </div>
                    </div>
                  <!--End Dòng -->
                     
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                           Địa chỉ</label>
                        <div class="col-md-8">
                            <telerik:radtextbox ID="txtAddress" CssClass="col-md-6 inputForm"  runat="server"/>
                              <asp:RequiredFieldValidator  ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtAddress" ValidationGroup="g1"
                           ErrorMessage="Required." >Required</asp:RequiredFieldValidator>
                        </div>
                    </div>
                  <!--End Dòng -->
                    
                     <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                           Email</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtEmail" CssClass="col-md-6 inputForm"  runat="server"   />
                        </div>
                    </div>
                  <!--End Dòng -->
                 </div>
                <!--End Block bên trái -->
                <!--Block bên phải -->
                 <div class="form-group col-md-6">
                      <!--Dòng -->
                    <div class="form-group">
                        <label class="col-md-3 control-label">
                            Tên khách hàng</label>
                        <div class="col-md-8">
                            <telerik:RadTextBox ID="txtCustomerName" CssClass="col-md-6 required"  runat="server"   />
                             <asp:RequiredFieldValidator  ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtCustomerName" ValidationGroup="g1"
                           ErrorMessage="Required." >Required</asp:RequiredFieldValidator>
                        </div>
                    </div>
                     <div class="form-group">
                        <label class="col-md-3 control-label">Tỉnh/Thành</label>
                        <div class="col-md-8">
                           <telerik:RadComboBox ID="cboProvince" runat="server" CssClass="col-imp-6 required" OnSelectedIndexChanged="cboProvince_SelectedIndexChanged" AutoPostBack="true" />
                            <asp:RequiredFieldValidator  ID="RequiredFieldValidator4" runat="server" ControlToValidate="cboProvince" ValidationGroup="g1"
                           ErrorMessage="Required." InitialValue="--Chọn--">Required</asp:RequiredFieldValidator>
                         </div>
                    </div>
                     <div class="form-group">
                        <label class="col-md-3 control-label">Quận/Huyện</label>
                        <div class="col-md-8">
                           <telerik:RadComboBox ID="cboDistrict" runat="server" CssClass="col-imp-6 required" />
                              <asp:RequiredFieldValidator  ID="RequiredFieldValidator5" runat="server" ControlToValidate="cboDistrict" ValidationGroup="g1"
                           ErrorMessage="Required." InitialValue="--Chọn--">Required</asp:RequiredFieldValidator>
                         </div>
                    </div>
                  <!--End Dòng -->
                 </div>
                <!--End Block bên phải -->
            </div>
             <!--Action-->
            <div class="set-btns text-center">
                <asp:Button ID="btnSave" CssClass="btn btn-sm btn-primary" runat="server" Text="Lưu" OnClick="btnSave_Click" ValidationGroup="g1" />
                <asp:Button ID="btnSearch" CssClass="btn btn-sm btn-primary" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click"/>
            </div>
            </div>
            <!--End Action -->
             <!--Grid data-->
            <div class="row">
                <telerik:RadGrid ID="gv" runat="server" AutoGenerateColumns="False" CellSpacing="0"
                    AllowMultiRowSelection="True" GridLines="None" HeaderStyle-HorizontalAlign="Center"
                    HeaderStyle-BorderStyle="None" CssClass="table table-bordered" AllowPaging="true"
                    PageSize="50" AllowCustomPaging="true" OnNeedDataSource="gvData_NeedDataSource">
                    <MasterTableView AllowPaging="True" PageSize="50" EditMode="InPlace" ShowHeader="true"
                        AutoGenerateColumns="False" NoMasterRecordsText="Không có dữ liệu.">
                        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                        </ExpandCollapseColumn>
                        <Columns>
                   <telerik:GridTemplateColumn HeaderText="STT" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" 
                        HeaderStyle-Width="50px">
                        <ItemTemplate>
                            <%# Eval("RowID") %></ItemTemplate>
                        <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </telerik:GridTemplateColumn>
                    
                    <telerik:GridTemplateColumn SortExpression="CustomerCode" HeaderText="Mã khách hàng"  UniqueName="CustomerCode">
                    <ItemTemplate>
                      <asp:LinkButton  ID="lnkCustomerCode" runat="server" Text='<%# Eval("CustomerCode") %>' style="cursor:pointer;text-decoration:underline;" 
                        OnClick="lnkCustomerCode_Click"></asp:LinkButton>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" Width="70px" />
                    <ItemStyle HorizontalAlign="Left" Width="70px" />
                    </telerik:GridTemplateColumn>
                     <telerik:GridBoundColumn DataField="CustomerName" HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                        HeaderText="Tên khách hàng" UniqueName="CustomerName">
                        <HeaderStyle HorizontalAlign="Left" Width="300px"></HeaderStyle>
                        <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="Address" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Địa chỉ" UniqueName="Address">
                    <HeaderStyle HorizontalAlign="Left" Width="300px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="District" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Quận/Huyện" UniqueName="District">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Province" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Tỉnh/Thành" UniqueName="Province">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="PhoneNumber" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Điện thoại" UniqueName="PhoneNumber">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="AccumulateAmount" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Điện thoại" UniqueName="AccumulateAmount">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="AccumulateAmount" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Tổng tiền tích lũy" UniqueName="AccumulateAmount">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn DataField="ConvertedAmount" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Tổng tiền đã quy đổi" UniqueName="ConvertedAmount">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="RemainAmount" HeaderStyle-HorizontalAlign="Center"
                    ItemStyle-HorizontalAlign="Left" FilterControlAltText="Filter Remark column"
                    HeaderText="Tổng tiền tích lũy còn lại" UniqueName="RemainAmount">
                    <HeaderStyle HorizontalAlign="Left" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                    </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
                </MasterTableView>
                <ClientSettings>
                <Selecting AllowRowSelect="true" /></ClientSettings>
                <ClientSettings>
                <Scrolling AllowScroll="true" UseStaticHeaders="True" SaveScrollPosition="True"></Scrolling>
                </ClientSettings>
                <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
                </telerik:RadGrid>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>

        <script type="text/javascript">
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                return oWindow;
            }

           
            function ClientClose() {
                var oArg = new Object();
                var objCustomerCode = "<%=txtCustomerCode.ClientID%>";
                oArg.CustomerCode = $('#' + objCustomerCode).val();

                var objCustomerName = "<%=txtCustomerName.ClientID%>";
                oArg.CustomerName = $('#' + objCustomerName).val();

                var objPhoneNumber = "<%=txtPhoneNumber.ClientID%>";
                oArg.PhoneNumber = $('#' + objPhoneNumber).val();

                var objAddress = "<%=txtAddress.ClientID%>";
                var objProvince = "<%=cboProvince.ClientID%>";
                var objDistrict = "<%=cboDistrict.ClientID%>";

                var addressFull = $('#' + objAddress).val() + ', ' + $('#' + objDistrict).val() + ', ' + $('#' + objProvince).val();
               
                oArg.Address = addressFull;
               // alert(oArg.Address);
                var oWnd = GetRadWindow();
               
                oWnd.close(oArg);
            }

            function ClientClose2(CustomerCode, CustomerName, PhoneNumber, addressFull) {
               
                var oArg = new Object();
                oArg.CustomerCode = CustomerCode;
                oArg.CustomerName = CustomerName;
                oArg.PhoneNumber = PhoneNumber;
                oArg.Address = addressFull;
                var oWnd = GetRadWindow();
                oWnd.close(oArg);
            }
      </script>
    </form>
</body>
</html>
